<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>盒子内垂直水平居中</title>
</head>
<style>
  .a{
    width: 500px;
    height: 500px;
    background-color: gray;
    text-align: center;
    line-height: 450px;
    font-size: 0;
  }
  span{
    background-color: aqua;
    font-size: 20px;
    vertical-align: middle;
    /*transform: translate(0,-100%);*/
  }
  img{
    border: pink 1px solid;
    width: 100px;
    height: 100px;
    /*!*只针对行内元素或者行内块元素 行内元素的基线相对于该元素所在行的基线的垂直对齐*!*/
    vertical-align: middle;
    /*position: relative;*/
  }
</style>
<body>
<div class="a">
  <span>X123456</span>
  <img src="../image/sg13.png" alt="">

</div>
</body>
</html>